import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 牛客网: 首页 > 试题广场 > 数据库连接池
 * <a href="https://www.nowcoder.com/questionTerminal/05f97d9b29944c018578d98d7f0ce56e">...</a>
 * User: DELL
 * Date: 2023-05-08
 * Time: 12:59
 */

/**
 * 解题思路:
 * 这里就是维护两个变量的值,即当前连接数和最大连接数,最后输出最大连接数即可,较为简单.
 */
public class Main {
    private static final String connect = "connect";

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            //这里是将数字后的回车清除,防止影响后续
            scanner.nextLine();
            int maxConnection = 0;
            int curConnection = 0;
            while (n-- != 0) {
                String seq = scanner.next();
                String request = scanner.next();
                if (request.equals(connect)) {
                    curConnection++;
                    maxConnection = Math.max(maxConnection,curConnection);
                } else {
                    curConnection--;
                }
            }
            System.out.println(maxConnection);
        }
    }
}
